package com.kantboot.business.water.web.admin.controller;

import com.kantboot.business.water.domain.dto.BusWaterLiftingPointSearchDTO;
import com.kantboot.business.water.domain.dto.BusWaterLiftingPointSearchFrontDTO;
import com.kantboot.business.water.domain.entity.BusWaterLiftingPoint;
import com.kantboot.business.water.service.IBusWaterLiftingPointService;
import com.kantboot.util.common.result.RestResult;
import com.kantboot.util.core.controller.BaseAdminController;
import com.kantboot.util.core.param.PageParam;
import com.kantboot.util.core.result.PageResult;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 提水点管理
 */
@RestController
@RequestMapping("/bus/water/admin/waterLiftingPoint")
public class BusWaterLiftingPointControllerOfAdmin
        extends BaseAdminController<BusWaterLiftingPoint,Long> {

    @Resource
    private IBusWaterLiftingPointService service;

    @RequestMapping("/getBodyData")
    public RestResult<PageResult> getBodyData(@RequestBody PageParam<BusWaterLiftingPointSearchDTO> pageParam) {
        return RestResult.success(service.getBodyData(pageParam), "getSuccess","获取成功");
    }

    @RequestMapping("/getListByUserId")
    public RestResult getUserList(@RequestParam("userId") Long userId) {
        return RestResult.success(service.getListByUserId(userId), "getSuccess", "获取成功");
    }

    @RequestMapping("/getBodyDataFront")
    public RestResult<PageResult> getBodyDataFront(@RequestBody PageParam<BusWaterLiftingPointSearchFrontDTO> pageParam) {
        return RestResult.success(service.getBodyDataFront(pageParam), "getSuccess","获取成功");
    }

    @RequestMapping("/getById")
    public RestResult<BusWaterLiftingPoint> getById(@RequestParam("id") Long id) {
        return RestResult.success(service.getById(id), "getSuccess","获取成功");
    }

    /**
     * 绑定提水点
     */
    @RequestMapping("/bindLiftingPoint")
    public RestResult bindLiftingPoint(@RequestParam("userId") Long userId, @RequestParam("liftingPointIds") List<Long> liftingPointIds) {
        service.bindLiftingPoint(userId, liftingPointIds);
        return RestResult.success(null,"bindSuccess","绑定成功");
    }



}
